package com.yuanfeng.business.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 店铺账期会员表
 * @TableName shop_account_period
 */
@TableName(value ="shop_account_period")
@Data
public class ShopAccountPeriodEntity implements Serializable {
    /**
     * 账期id
     */
    @TableId(type = IdType.AUTO)
    private Integer accountId;

    /**
     * 店铺id
     */
    private Integer shopId;

    /**
     * 用户id
     */
    private String userId;

    /**
     * 是否授权账期 0，未授权 1，已授权 2，已冻结
     */
    private Long isAccount;

    /**
     * 账期是否限额 0，不限 1，限额
     */
    private Long accountIsLimit;

    /**
     * 账期金额
     */
    private BigDecimal accountPeriodPrice;

    /**
     * 账期时间
     */
    private Integer accountPeriodTime;

    /**
     * 账期插入时间
     */
    private Date accountInsertTime;

    /**
     * 已用金额
     */
    private BigDecimal amountUsed;

    /**
     * 可用金额
     */
    private BigDecimal availableAmount;

    /**
     * 本月已用金额
     */
    private BigDecimal monthAmountUsed;

    /**
     * 账期修改时间
     */
    private Date accountUpdateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ShopAccountPeriodEntity other = (ShopAccountPeriodEntity) that;
        return (this.getAccountId() == null ? other.getAccountId() == null : this.getAccountId().equals(other.getAccountId()))
            && (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getIsAccount() == null ? other.getIsAccount() == null : this.getIsAccount().equals(other.getIsAccount()))
            && (this.getAccountIsLimit() == null ? other.getAccountIsLimit() == null : this.getAccountIsLimit().equals(other.getAccountIsLimit()))
            && (this.getAccountPeriodPrice() == null ? other.getAccountPeriodPrice() == null : this.getAccountPeriodPrice().equals(other.getAccountPeriodPrice()))
            && (this.getAccountPeriodTime() == null ? other.getAccountPeriodTime() == null : this.getAccountPeriodTime().equals(other.getAccountPeriodTime()))
            && (this.getAccountInsertTime() == null ? other.getAccountInsertTime() == null : this.getAccountInsertTime().equals(other.getAccountInsertTime()))
            && (this.getAmountUsed() == null ? other.getAmountUsed() == null : this.getAmountUsed().equals(other.getAmountUsed()))
            && (this.getAvailableAmount() == null ? other.getAvailableAmount() == null : this.getAvailableAmount().equals(other.getAvailableAmount()))
            && (this.getMonthAmountUsed() == null ? other.getMonthAmountUsed() == null : this.getMonthAmountUsed().equals(other.getMonthAmountUsed()))
            && (this.getAccountUpdateTime() == null ? other.getAccountUpdateTime() == null : this.getAccountUpdateTime().equals(other.getAccountUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getAccountId() == null) ? 0 : getAccountId().hashCode());
        result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getIsAccount() == null) ? 0 : getIsAccount().hashCode());
        result = prime * result + ((getAccountIsLimit() == null) ? 0 : getAccountIsLimit().hashCode());
        result = prime * result + ((getAccountPeriodPrice() == null) ? 0 : getAccountPeriodPrice().hashCode());
        result = prime * result + ((getAccountPeriodTime() == null) ? 0 : getAccountPeriodTime().hashCode());
        result = prime * result + ((getAccountInsertTime() == null) ? 0 : getAccountInsertTime().hashCode());
        result = prime * result + ((getAmountUsed() == null) ? 0 : getAmountUsed().hashCode());
        result = prime * result + ((getAvailableAmount() == null) ? 0 : getAvailableAmount().hashCode());
        result = prime * result + ((getMonthAmountUsed() == null) ? 0 : getMonthAmountUsed().hashCode());
        result = prime * result + ((getAccountUpdateTime() == null) ? 0 : getAccountUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", accountId=").append(accountId);
        sb.append(", shopId=").append(shopId);
        sb.append(", userId=").append(userId);
        sb.append(", isAccount=").append(isAccount);
        sb.append(", accountIsLimit=").append(accountIsLimit);
        sb.append(", accountPeriodPrice=").append(accountPeriodPrice);
        sb.append(", accountPeriodTime=").append(accountPeriodTime);
        sb.append(", accountInsertTime=").append(accountInsertTime);
        sb.append(", amountUsed=").append(amountUsed);
        sb.append(", availableAmount=").append(availableAmount);
        sb.append(", monthAmountUsed=").append(monthAmountUsed);
        sb.append(", accountUpdateTime=").append(accountUpdateTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}